home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / Cell Control / DATA1.CAB / DELPHIDM / UText.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-01-11  |  3.5 KB  |  106 lines

  1. unit UText;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Tempunit, ComCtrls, StdCtrls, Buttons, OleCtrls, CELLLib_TLB, ExtCtrls;
  8.  
  9. type
  10.   TFText = class(TTemplate)
  11.     procedure FormShow(Sender: TObject);
  12.   private
  13.     { Private declarations }
  14.   public
  15.     { Public declarations }
  16.   end;
  17.  
  18. var
  19.   FText: TFText;
  20.  
  21. implementation
  22.  
  23. {$R *.DFM}
  24.  
  25. procedure TFText.FormShow(Sender: TObject);
  26. Var
  27.   i  ,j: integer;
  28. begin
  29.   inherited;
  30.     Cell1.DoSetDefaultColWidth(100);
  31.     Cell1.DoSetDefaultRowHeight(45);
  32.     Cell1.DoSetDefaultFont(10,0,'Verdana');
  33.     Cell1.Cols := 5;
  34.     Cell1.Rows := 9;
  35.     Cell1.DoSetCellData( 0, -1, 'Snap');
  36.     Cell1.DoSetCellAlignment( 0, 0, $9);
  37.     Cell1.DoSetCellData(0, 0, 'Left up');
  38.     Cell1.DoSetCellAlignment( 0, 1, $C);
  39.     Cell1.DoSetCellData( 0, 1, 'Center up');
  40.     Cell1.DoSetCellAlignment( 0, 2, $A);
  41.     Cell1.DoSetCellData( 0, 2, 'Right up');
  42.  
  43.     Cell1.DoSetCellAlignment( 0, 3, $21);
  44.     Cell1.DoSetCellData( 0, 3, 'Left center' );
  45.     Cell1.DoSetCellAlignment( 0, 4, $24);
  46.     Cell1.DoSetCellData( 0, 4, 'Center');
  47.     Cell1.DoSetCellAlignment( 0, 5, $22);
  48.     Cell1.DoSetCellData( 0, 5, 'Right center');
  49.     Cell1.DoSetCellAlignment( 0, 6, $11);
  50.     Cell1.DoSetCellData( 0, 6, 'Left low');
  51.     Cell1.DoSetCellAlignment( 0, 7, $14);
  52.     Cell1.DoSetCellData( 0, 7, 'Center low');
  53.     Cell1.DoSetCellAlignment( 0, 8, $12);
  54.     Cell1.DoSetCellData( 0, 8, 'Right low');
  55.     Cell1.DoSetCellData( 1, -1, 'Multiline');
  56.     j:=Cell1.Rows - 1 ;
  57.     For i := 0 To j   do
  58.     begin
  59.         Cell1.DoSetCellTextStyle( 1, i, 1);
  60.     end;
  61.  
  62.     Cell1.DoSetCellData( 1, 0, 'Change the width');
  63.     Cell1.DoSetCellData( 1, 1, 'Newline automatic');
  64.     Cell1.DoSetCellData( 1, 2, 'ROW1' + Chr(13) + 'ROW2');
  65.     Cell1.DoJoinCells  ( 1, 3, 1, 4);
  66.     Cell1.DoSetCellData( 1, 3, 'Unite multiling of text in the cell');
  67.  
  68.     Cell1.DoSetCellData( 2, -1, '...show');
  69.     For i := 0 To Cell1.Rows - 1  do
  70.     begin
  71.         Cell1.DoSetCellTextStyle( 2, i, 2);
  72.     end;
  73.     Cell1.DoSetCellData( 2, 0, 'When one line is too longú¼');
  74.     Cell1.DoSetCellData( 2, 1, 'the invisible part will be replace by "..."');
  75.     Cell1.DoSetCellData( 2, 2, 'Change the with of cell can see it');
  76.     Cell1.DoJoinCells  ( 2, 3, 2, 4);
  77.     Cell1.DoSetCellData( 2, 3, 'Unite all invisible lines');
  78.  
  79.  
  80.     Cell1.DoSetCellData (3, -1, 'Color');
  81.     Cell1.DoSetCellColor(3, 0, RGB(255, 0, 0), RGB(255, 255, 255));
  82.     Cell1.DoSetCellData (3, 0, 'Each cell');
  83.     Cell1.DoSetCellColor(3, 1, RGB(0, 255, 0), RGB(255, 255, 255));
  84.     Cell1.DoSetCellData (3, 1, 'had their ');
  85.     Cell1.DoSetCellColor(3, 2, RGB(0, 0, 255), RGB(255, 255, 255));
  86.     Cell1.DoSetCellData (3, 2, 'foreground color');
  87.     Cell1.DoSetCellColor(3, 3, RGB(127, 127, 127), RGB(0, 0, 0));
  88.     Cell1.DoSetCellData (3, 3, '& background color');
  89.  
  90.     Cell1.DoSetCellData(4, -1, 'Font');
  91.     Cell1.DoSetCellFont(4, 0, 12, 0, 'MT Extra');
  92.     Cell1.DoSetCellData(4, 0, 'MT Extra 12');
  93.     Cell1.DoSetCellFont(4, 1, 14, 0, 'Courier New');
  94.     Cell1.DoSetCellData(4, 1, 'Courier New 14');
  95.     Cell1.DoSetCellFont(4, 2, 18, 0, 'Arial');
  96.     Cell1.DoSetCellData(4, 2, 'Arial 18');
  97.     Cell1.DoSetCellFont(4, 3, 10, 1, 'Arial');
  98.     Cell1.DoSetCellData(4, 3, 'Arial Bold');
  99.     Cell1.DoSetCellFont(4, 4, 10, 2, 'Arial');
  100.     Cell1.DoSetCellData(4, 4, 'Arial inclined');
  101.     Cell1.DoSetCellFont(4, 5, 10, 6, 'Symbol');
  102.     Cell1.DoSetCellData(4, 5, 'Symbol with underline');
  103. end;
  104.  
  105. end.
  106.